<template>
  <el-card shadow="never">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <el-form :inline="true" :model="searchModel" size="small" >
        <el-form-item label="公司名称">
          <el-input v-model="searchModel.name" placeholder="公司名称"></el-input>
        </el-form-item>
        <el-form-item>
              <span style="float: left;overflow: hidden;" class="">
                  <el-button type="primary" @click="searchQuery" icon="el-icon-search">查询</el-button>
                  <el-button type="primary" @click="searchReset" icon="el-icon-refresh" style="margin-left: 8px">重置</el-button>
              </span>
        </el-form-item>
      </el-form>
    </div>
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <el-button  size="small " class="addBtn" type="primary" @click="handleAdd">新增</el-button>
    </div>
    <el-table ref="multipleTable"
              border
              highlight-current-row
              size="small"
              style="width: 100%"
              v-loading="loading"
              :data="dataSource"
              @row-click="rowClick"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}">
      <el-table-column align="center" label="#"  width="55">
        <template slot-scope="scope">
          <el-radio v-model="singleSelRowKey" :label="scope.row.id">&nbsp;</el-radio>
        </template>
      </el-table-column>
      <el-table-column prop="dictCode" label="字典号"></el-table-column>
      <el-table-column prop="dictName" label="字典名称" sortable></el-table-column>
      <el-table-column prop="description"  label="备注" sortable></el-table-column>
      <el-table-column  width="150" fixed="right" label="操作">
        <template slot-scope="scope">
            <el-button @click="handleEdit(scope.row)" type="text">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination
      :total="ipagination.total"
      :page.sync="ipagination.current"
      :limit.sync="ipagination.pageSize"
      @pagination="loadData"
    ></pagination>
    <dict-modal ref="modalForm" @ok="modalFormOk"></dict-modal>
    <sys-dict-item ref="item"></sys-dict-item>
  </el-card>
</template>

<script>

  import { SingleTableMixins } from '@/mixins/SingleTableMixins'
  import Pagination from '@/components/Pagination'
  import { putAction,postAction} from '@/api/manage'
  import DictModal from './DictModal'
  import SysDictItem from './SysDictItem'
  export default {
    name: 'SysDict',
    mixins: [ SingleTableMixins ],
    components: { SysDictItem,DictModal,Pagination},
    data() {
      return {
        url:{
          list: "/sys/dict/list",
          delete: "/sys/dict/delete"
        },
        ipagination:{
          pageSize: 10,
          current:1,
          total: 0
        }
      }
    },
    methods: {
      // 表单选择
      selectChange(e){
        this.$refs.item.getDataByMain(this.singleSelRowKey,this.singleSelRows);
      }
    }
  }
</script>

<style scoped>

</style>
